<%@ include file="../../base/include.jsp"%>

<c:url var="saveNewsAction" value="/admin/news/save"/>


<form:form id="newsForm" commandName="newsCommand" action="${saveNewsAction}" 
	class="form-horizontal" 
	enctype="multipart/form-data"
	>
	<fieldset>	
	<form:hidden path="id"/>
	<form:hidden path="type"/>
	<div class="control-group">	
		<img src="<c:url value="/news-img/${newsCommand.id}"/>" />
	</div>
	<div class="control-group">
		Subject:
		<form:input path="subject"/>
	</div>
	<c:if test="${newsCommand.type == 'DEFAULT' }">
		<div class="control-group">
			Picture:
			<form:input path="imgFile" type="file" />
		</div>
	</c:if>
	<div class="control-group">
		URL:
		<form:input path="url"/>
	</div>
	<div class="control-group">
		<form:textarea id="newsValue" path="news" class="span12" style="resize: none;"/>
	</div>
	<div class="control-group">
		<button class="btn btn-primary" type="submit">Save</button>
		<a href="#" class="btn" onclick="history.back()">Cansel</a>
	</div>
	</fieldset>
	<script>
		$(function () {
			var editor = CKEDITOR.replace('newsValue', {/*extraPlugins : 'bbcode', */toolbar : 'Basic'});
		});
	</script>
</form:form>